package com.jk.service;


import com.jk.dao.UserDao;
import com.jk.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    @Autowired
    private RedisTemplate redisTemplate;


    public UserEntity queryUserById(HttpServletRequest request) {
        UserEntity user = (UserEntity) request.getSession().getAttribute("user");
        UserEntity user1= userDao.queryUserById(user.getUser_id());
        return user1;
    }

    public void updUserPass(HttpServletRequest request, String pass) {
        UserEntity user = (UserEntity) request.getSession().getAttribute("user");
        userDao.updUserPass(user.getUser_id(),pass);
    }

    public void updatePass(HttpServletRequest request, String pass) {
        UserEntity user= (UserEntity) request.getSession().getAttribute("user");
        userDao.updatePass(user.getUser_id(),pass);
    }
}
